<?php
/**
 * Dependency node abstract filter
 *
 * PHP version 5
 *
 * @category  W
 * @package   Services
 * @author    Olivier Hoareau <olivier@phppro.fr>
 * @copyright 2009 PHPPRO http://www.phppro.fr
 * @license   http://dev.phppro.fr/license PHPPRO
 * @version   SVN: $Id:$
 * @link      http://dev.phppro.fr/projects/wdependency
 */
require_once 'W/Dependency/Filter/Abstract.php';
/**
 * Dependency node abstract filter
 *
 * @category  W
 * @package   Services
 * @author    Olivier Hoareau <olivier@phppro.fr>
 * @copyright 2009 PHPPRO http://www.phppro.fr
 * @license   http://dev.phppro.fr/license PHPPRO
 * @version   SVN: $Id$
 * @link      http://dev.phppro.fr/projects/wdependency
 */
abstract class W_Dependency_Filter_Node_Abstract extends W_Dependency_Filter_Abstract
{
    public function filter($data)
    {
        $data = $data['data'];
        foreach(array_keys($data) as $node) {
            if (false === $this->isValidNode($node,$data[$node])) {
                unset($data[$node]);
            }
        }
        return $data;
    }
    public abstract function isValidNode($node,$data);
}